#include "BoardColumn.h"

BoardColumn::BoardColumn(QObject *parent) :
    QObject(parent) {
    numberOfPieces = 0;
}

int BoardColumn::getNumberOfPieces() const {
    return numberOfPieces;
}

ConnectFour::Piece BoardColumn::getPiece(int index) const {
    return pieces[index];
}

bool BoardColumn::addPiece(ConnectFour::Piece color) {
    if (numberOfPieces == NUM_ROWS) {
        return false;
    }
    pieces[numberOfPieces++] = color;
    return true;
}

void BoardColumn::undoPiece() {
    numberOfPieces--;
}

void BoardColumn::resetPieces() {
    numberOfPieces = 0;
}

bool BoardColumn::isFull() const {
    return numberOfPieces == NUM_ROWS;
}
